package com.storm.core.controller

import com.storm.queue.QueueApi
import com.storm.queue.model.Job
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/delay")
/**
 * 注入QueueApi 进行job的添加
 */
class TestController(private val queueApi: QueueApi) {

    @GetMapping("/putJob")
    fun test(): String {
        queueApi.addJob(Job("test_job_id"), "test", System.currentTimeMillis() + 10000)
        return "success"
    }

}